package com.ztsoft.user.controller.project;

import com.ztsoft.user.pojo.entity.project.PExpend;
import com.ztsoft.user.pojo.entity.project.PModel;
import com.ztsoft.user.pojo.page.PageQuery;
import com.ztsoft.user.service.project.ExpendService;
import com.ztsoft.user.service.project.ModelService;
import com.ztsoft.user.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 12487
 */
@Slf4j
@RestController
@CrossOrigin("*")
@RequestMapping("/expend")
public class ExpendController {
    @Resource
    private ExpendService expendService;
    /**
     * 查看单个
     */
    @GetMapping("/total/{projectId}")
    public Result<Object> total(@PathVariable String projectId) {
        return expendService.total(projectId);
    }
    /**
     * 查看
     */
    @GetMapping("/list")
    public Result<Object> list(PExpend bo, PageQuery pageQuery) {
        return expendService.list(bo, pageQuery);
    }
    /**
     * 查看单个
     */
    @GetMapping("/{id}")
    public Result<Object> modelOne(@PathVariable String id) {
        return expendService.expendOne(id);
    }
    /**
     * 添加
     */
    @PostMapping()
    public Result<Object> add(@RequestBody PExpend bo) {
        return expendService.add(bo);
    }
    /**
     * 添加
     */
    @PutMapping()
    public Result<Object> update(@RequestBody PExpend bo) {
        return expendService.update(bo);
    }
    /**
     * 删除
     */
    @DeleteMapping ()
    public Result<Object> delete(String [] ids) {
        return expendService.delete(ids);
    }
}
